#ifndef _PLATFORM_H_
#define _PLATFORM_H_

// Include some standard files
#if defined(_WIN32)
#  define WIN32_LEAN_AND_MEAN

#  ifndef _WIN32_WINNT
#     define _WIN32_WINNT 0x0500
#  endif

#  ifndef WINVER
#     define WINVER 0x0500
#  endif

#  include <windows.h>
#else
#  include <sys/time.h>
#  if defined(LINUX)
#    include <X11/keysym.h>
#    include <stdio.h>
#  elif defined(__APPLE__)
#  endif
#endif

//#include <limits.h>
#include <float.h>


// Define some sized types
typedef unsigned char uint8;
typedef   signed char  int8;

typedef unsigned short uint16;
typedef   signed short  int16;

typedef unsigned int uint32;
typedef   signed int  int32;

#include <stddef.h>
typedef ptrdiff_t intptr;

#ifdef _WIN32
	typedef   signed __int64  int64;
	typedef unsigned __int64 uint64;
	typedef LARGE_INTEGER timestamp;
#else
	typedef   signed long long  int64;
	typedef unsigned long long uint64;
	typedef timeval timestamp;
#endif

typedef unsigned char ubyte;
typedef unsigned short ushort;
typedef unsigned int uint;


#ifdef _DEBUG
#  define DEBUG
#endif


#define elementsOf(x) (sizeof(x) / sizeof(x[0]))
#define offsetOf(strct, member) uint(((strct *) NULL)->member)

#ifdef _WIN32
#define forceinline __forceinline
#define alignment(x) __declspec(align(x))
#else
#define forceinline inline
#define alignment(x) __attribute__ ((aligned(x)))
#endif

// Utility functions
#ifdef _WIN32

void ErrorMsg(const char *string);

void WarningMsg(const char *string);

void InfoMsg(const char *string);

#endif

#endif // _PLATFORM_H_
